﻿using AppService.IService.System_setting;
using Domain.Entity.System_setting;
using Domain.IRepository.System_setting;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection;

namespace AppService.Service.System_setting
{
    [Dependency(ServiceLifetime.Scoped)]
    public class EmployeeService : IEmployeeService
    {

        public EmployeeService(IEmployeeRepository employeeRepository)
        {
            this.employeeRepository = employeeRepository;
        }
        public IEmployeeRepository employeeRepository { get; set; }

        public bool DelAll(int id)
        {
            return employeeRepository.DelAll(id) > 0;
        }

        public List<Ment_employee> GetAll(int currentPage, int pageSize, int uid, string value)
        {
            return employeeRepository.GetAll(uid, value).Skip((currentPage - 1) * pageSize).Take(pageSize).ToList();
        }

        public int GetCount(int uid, string value)
        {
            return employeeRepository.GetCount(uid, value);
        }

        public string GetDeparts(int id)
        {
            return employeeRepository.GetDeparts(id);
        }

        public Ment_employee? GetLogin(string username, string password)
        {
            return employeeRepository.GetLogin(username, password);
        }

        public Ment_role GetRoles(int id)
        {
            return employeeRepository.GetRoles(id);
        }

        public List<Ment_role> GetTypeRole()
        {
            return employeeRepository.GetTypeRole();
        }

        public bool IsEmpId(int id)
        {
            return employeeRepository.GetEid(id) > 0;
        }
    }
}
